<%@ Page Language="C#" MasterPageFile="~/MasterPageMcSigAdmin.master" AutoEventWireup="true"
    CodeFile="Actividades.aspx.cs" Inherits="Actividades" Title="Untitled Page" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.3.Export, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<h1 class="presupuesto">Actividades</h1>
    <asp:SqlDataSource ID="SqlDataSourceRubros" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
        SelectCommand="SELECT [PLN_ID], [PLN_NOMBRE] FROM [SIG_PLAN_ACCION]"></asp:SqlDataSource>
    <dx:ASPxGridView ID="ASPxGridViewActividades" runat="server" AutoGenerateColumns="False"
        CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css" CssPostfix="PlasticBlue"
        DataSourceID="SqlDataSourceActividades" KeyFieldName="SAC_ID" Width="100%" OnCellEditorInitialize="ASPxGridViewActividades_CellEditorInitialize" OnCommandButtonInitialize="ASPxGridViewActividades_CommandButtonInitialize">
        <Styles CssPostfix="PlasticBlue" CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css">
            <Header SortingImageSpacing="10px" ImageSpacing="10px">
            </Header>
        </Styles>
        <SettingsPager ShowDefaultImages="False">
            <AllButton Text="All">
            </AllButton>
            <NextPageButton Text="Next &gt;">
            </NextPageButton>
            <PrevPageButton Text="&lt; Prev">
            </PrevPageButton>
        </SettingsPager>
        <ImagesFilterControl>
            <LoadingPanel Url="~/App_Themes/PlasticBlue/Editors/Loading.gif">
            </LoadingPanel>
        </ImagesFilterControl>
        <Images SpriteCssFilePath="~/App_Themes/PlasticBlue/{0}/sprite.css">
            <LoadingPanelOnStatusBar Url="~/App_Themes/PlasticBlue/GridView/gvLoadingOnStatusBar.gif">
            </LoadingPanelOnStatusBar>
            <LoadingPanel Url="~/App_Themes/PlasticBlue/GridView/Loading.gif">
            </LoadingPanel>
        </Images>
        <Columns>
            <dx:GridViewCommandColumn VisibleIndex="0" Width="200px">
                <EditButton Text="Editar" Visible="True">
                </EditButton>
                <NewButton Text="Nuevo" Visible="True">
                </NewButton>
                <DeleteButton Text="Borrar" Visible="True">
                </DeleteButton>
                <CancelButton Text="Cancelar">
                </CancelButton>
                <UpdateButton Text="Guardar">
                </UpdateButton>
                <ClearFilterButton Text="Limpiar" Visible="True">
                </ClearFilterButton>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataTextColumn FieldName="SAC_ID" ReadOnly="True" Visible="False" VisibleIndex="1">
                <EditFormSettings Visible="False" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataMemoColumn Caption="Actividad" FieldName="SAC_NOMBRE" VisibleIndex="2">
                <PropertiesMemoEdit Height="130px">
                </PropertiesMemoEdit>
            </dx:GridViewDataMemoColumn>
            <dx:GridViewDataTextColumn FieldName="PLN_NOMBRE" Caption="Rubro" ReadOnly="True" VisibleIndex="1" Width="300px">
                <EditFormSettings Visible="False" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataComboBoxColumn Caption="Rubro" FieldName="PLN_ID" VisibleIndex="1" Visible=False Width="300px">
            <EditFormSettings Visible="True" />
                <PropertiesComboBox CallbackPageSize="15" EnableCallbackMode="True" EnableIncrementalFiltering="True"
                    ValueType="System.String">
                </PropertiesComboBox>
                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" ShowFilterRowMenu="True" />
            </dx:GridViewDataComboBoxColumn>
        </Columns>
        <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowTitlePanel="True"></Settings>
        <StylesEditors>
            <CalendarHeader Spacing="11px">
            </CalendarHeader>
            <ProgressBar Height="25px">
            </ProgressBar>
        </StylesEditors>
        <SettingsLoadingPanel Text="Cargando&amp;hellip;" />
        <SettingsCookies Enabled="True" />
        <SettingsEditing Mode="PopupEditForm" PopupEditFormHeight="200px" PopupEditFormHorizontalAlign="WindowCenter"
            PopupEditFormModal="True" PopupEditFormWidth="700px" />
        <SettingsText GroupPanel="Arrastre las columnas  aqui para agrupar" Title="Actividades" />
    </dx:ASPxGridView>
    <asp:SqlDataSource ID="SqlDataSourceActividades" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
        DeleteCommand="DELETE FROM [SIG_ACTIVIDADES] WHERE [SAC_ID] = @SAC_ID" 
        InsertCommand="INSERT INTO [SIG_ACTIVIDADES] ([SAC_NOMBRE], [PLN_ID]) VALUES (@SAC_NOMBRE, @PLN_ID)"
        SelectCommand="SELECT SIG_ACTIVIDADES.SAC_ID, SIG_ACTIVIDADES.SAC_NOMBRE,SIG_PLAN_ACCION.PLN_NOMBRE, SIG_ACTIVIDADES.PLN_ID FROM SIG_ACTIVIDADES INNER JOIN SIG_PLAN_ACCION ON	SIG_ACTIVIDADES.PLN_ID= SIG_PLAN_ACCION.PLN_ID"
        UpdateCommand="UPDATE [SIG_ACTIVIDADES] SET [SAC_NOMBRE] = @SAC_NOMBRE, [PLN_ID] = @PLN_ID WHERE [SAC_ID] = @SAC_ID">
        <DeleteParameters>
            <asp:Parameter Name="SAC_ID" Type="Decimal" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="SAC_NOMBRE" Type="String" />
            <asp:Parameter Name="PLN_ID" Type="Decimal" />
            <asp:Parameter Name="SAC_ID" Type="Decimal" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="SAC_NOMBRE" Type="String" />
            <asp:Parameter Name="PLN_ID" Type="Decimal" />
        </InsertParameters>
    </asp:SqlDataSource>
    <dx:ASPxGridViewExporter ID="ASPxGridViewExporterActividades" runat="server" GridViewID="ASPxGridViewActividades">
    </dx:ASPxGridViewExporter>
    <dx:ASPxButton ID="ASPxButtonExportar" runat="server" OnClick="ASPxButtonExportar_Click"
        Text="Exportar a Excel" CssClass="boton">
    </dx:ASPxButton>
</asp:Content>
